<template>
  <div class="columnContainer">
    <div class="column-item" v-for="item in list" :key="item.id">
      <img :src="item.avatar" alt="" class="avator" />
      <div class="item-body">
        <div class="item-title">{{ item.title }}</div>
        <div class="item-desc">{{ item.description }}</div>
      </div>
      <a-button>进入专栏</a-button>
    </div>
  </div>
</template>

<script lang="ts">
import { defineComponent, PropType } from "vue";
export interface ColumnProps {
  id: number;
  avatar: string;
  title: string;
  description: string;
}
export default defineComponent({
  name: "ColumnList",
  props: {
    list: {
      // PropType泛型
      type: Array as PropType<ColumnProps[]>,
      require: true,
    },
  },
});
</script>

<style lang="scss" scoped>
.columnContainer {
  height: auto;
  width: 1200px;
  margin: auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  .column-item {
    width: calc(33.3% - 20px);
    height: 300px;
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 12.5px 25px rgba(0, 0, 0, 0.075) !important;
    img {
      width: 50px;
      height: 50px;
      border-radius: 50%;
    }
    .item-body {
      margin-top: 10px;
      height: calc(100% - 100px);
      .item-title {
        font-weight: bold;
        font-size: 20px;
        white-space: nowrap;
      }
      .item-desc {
        height: calc(100% - 52px);
        // border: 1px solid red;
        overflow: hidden;
        text-overflow: ellipsis;
        line-height: 25px;
        -webkit-line-clamp: 4;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        margin-bottom: 20px;
      }
    }
    &:hover{
      border-color: #98C4FF;
      // background-image: linear-gradient(to bottom,#F8F8F8,#F0F8FF);
    }
  }
}
</style>
